<template>
	<view class="u-flex-1">
		<u-input inputAlign="right" placeholder="请选择异常类型" v-model="label" type="select" @click="show=true" />
		<u-picker mode="selector" v-model="show" :default-selector="[0]" range-key="label" :range="exceptionTypes"
			@confirm="confirm"></u-picker>
	</view>
</template>

<script setup>
	const zoneId = defineModel()
	const show = ref(false)
	const label = ref('')

	const exceptionTypes = ref([])

	const emit = defineEmits(['confirm'])

	function confirm(e) {
		label.value = exceptionTypes.value[e[0]].label
		zoneId.value = exceptionTypes.value[e[0]].value
		emit('confirm')
	}
	
	function init() {
		$api.user.prepareBookException().then(res => {
			exceptionTypes.value = res.data.exceptionTypes
		})
	}
	
	onMounted(init)
</script>

<style>

</style>